#!/usr/bin python3
# -*- coding:UTF-8 -*-
# Author: nigo

import pandas as pd

# 创建第一个dataframe
df1 = pd.DataFrame(
    {
        "A": [1, 5, 3, 4, 2, 6],
        "B": [3, 2, 4, 3, 4, 6],
        "C": [2, 2, 7, 3, 4, 6],
        "D": [4, 3, 6, 12, 7, 6],
    },
    index=["A1", "A2", "A3", "A4", "A5", "A6"])

# 创建第二个dataframe
df2 = pd.DataFrame(
    {
        "A": [10, 11, 7, 8, 5],
        "B": [21, 5, 32, 4, 6],
        "C": [11, 21, 23, 7, 9],
        "D": [1, 5, 3, 8, 6]
    },
    index=["A1", "A2", "A3", "A4", "A5"])

df = df1.sub(df2, fill_value=0)
print(df1)
print(df2)
print(df)
